package com.example.demo.order.controller;

import com.alibaba.fastjson2.JSON;
import com.example.demo.order.feign.WeatherFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/feign")
public class FeignController {


    @Autowired
    private WeatherFeignClient weatherFeignClient;


    @GetMapping
    public Object getWeather(@RequestParam("city") String city) {
        String response = weatherFeignClient.getWeather(city);
        return JSON.parseObject(response);
    }

}
